import React, { Fragment, PureComponent } from 'react'
import { connect } from 'dva'
import { OssUpload } from 'scd'
import { Form, Input, Spin } from 'antd'
const FormItem = Form.Item;

@connect(({ loading, dispatch, orgInsider }) => ({
  orgInsider: orgInsider,
  searchloading: loading.effects['orgInsider/searchOrganizaInsider']
}))
@Form.create()

class OrgModalForm extends PureComponent {

  render() {
    const { form, modalType, orgInsider: { orgDepartmentInfo }, searchloading } = this.props
    const formItemLayout = {
      labelCol: {
        xs: { span: 24 },
        sm: { span: 5 },
      },
      wrapperCol: {
        xs: { span: 24 },
        sm: { span: 18 },
      },
    };
    return (
      <Fragment>
        <Spin
          size="small"
          spinning={!!searchloading}
          tip="加载中...">
          <Form layout="horizontal">
            <FormItem {...formItemLayout} label="部门名称">
              {form.getFieldDecorator('name', {
                initialValue: modalType === 'edit' ? orgDepartmentInfo.name : null,
                rules: [{ required: true, message: '部门名称不能为空' },
                {
                  // validator: this.validateToNextPassword
                }],
              })(<Input placeholder="请输入部门名称" />)}
            </FormItem>
            <FormItem {...formItemLayout} label="部门说明" >
              {form.getFieldDecorator('illustrate', {
                initialValue: modalType === 'edit' ? orgDepartmentInfo.illustrate : null,
              })
                (<Input.TextArea style={{ height: '100px' }} placeholder="请输入描述" />)
              }
            </FormItem>
          </Form>
        </Spin>
      </Fragment>
    );
  }
}

export default OrgModalForm;









